home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / OUTTEXT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  961 b   |  30 lines

  1.  
  2. /* outtext.c---outtext, p 845 */
  3. #include <graphics.h>
  4. char title[] = "Turboc C Graphics Window";
  5. main()
  6. {
  7.     int graphdriver = DETECT, graphmode, xmax, ymax, xsize, ysize;
  8.                 /* DetecT and initialize graphics system */
  9.     initgraph(&graphdriver, &graphmode, "c:\\turboc");
  10.                 /* Display a graphics window with a title */
  11.     xmax = getmaxx();
  12.     ymax = getmaxy();
  13.     xsize = xmax - 100;
  14.     ysize = ymax - 60;
  15.     setviewport(50, 30, xsize+50, ysize+30,1);
  16.     setfillstyle(SOLID_FILL, RED);
  17.     setcolor(YELLOW);
  18.     bar3d(0,0,xsize,ysize,0,1);
  19.             /* Draw title bar and print title with outtext */
  20.     settextstyle(SANS_SERIF_FONT, HORIZ_DIR, 1);
  21.     settextjustify(LEFT_TEXT, BOTTOM_TEXT);
  22.     rectangle(0,0,xsize,textheight("H")+4);
  23.     moveto((xsize-textwidth(title))/2, textheight("H"));
  24.     outtext(title);
  25.                     /* Wait until a key is pressed */
  26.     moveto(10, ysize-10);
  27.     outtext("Press any key to exit\n");
  28.     getch();
  29.     closegraph();            /* Exit graphics library */
  30. }